package com.project.module.utill;

public class ResultBeanUtil {


    public static ResultBean SUCCESS(Object data) {
        ResultBean resultBean = new ResultBean();
        resultBean.setResponseCode(ResultEnum.SUCCESS.getCode());
        resultBean.setErrorMsg("");
        resultBean.setData(data);
        return resultBean;
    }

    public static ResultBean SUCCESS() {
        return SUCCESS(null);
    }

    public static ResultBean failed(String code, String errorMsg) {

        ResultBean resultBean = new ResultBean();
        resultBean.setResponseCode(code);
        resultBean.setErrorMsg(errorMsg);
        return resultBean;

    }

    public static ResultBean failed(String errorMsg) {
        ResultBean resultBean = failed(ResultEnum.ERROR.getCode(), errorMsg);
        return resultBean;

    }

    /**
     * 错误  有数据
     *
     * @param errorMsg
     * @param object
     * @return
     */
    public static ResultBean failed(String errorMsg, Object object) {
        ResultBean resultBean = new ResultBean();
        resultBean.setResponseCode(ResultEnum.ERROR.getCode());
        resultBean.setErrorMsg(errorMsg);
        resultBean.setData(object);
        return resultBean;


    }

}
